from django.utils.deprecation import MiddlewareMixin
class TestMiddleWare(MiddlewareMixin):
    def process_request(self, request):
        # print("我是TestMiddleWare")
        return

    def process_response(self, request, response):

        # 基于请求响应
        # print("*********************************************响应结束******************************", id(request))  # 在视图之后
        return response